Light BalanceThe script is simple, going for a color scheme logic which tenderly avoids rigorous signals processing.
For the script to remain simple, logical derivatives are also out; as such, there are no secondary relations built off of primary ones. And it also ignores (unless you do this yourself) the logic in a varying order of lines.
Coloring has been done according to a limited set of relations between the four (4) plotted lines.
Quite a bit of information is capture, as you'll see when looking at line order, crossings, and transparency transitions and their patterns.
The approach makes the relations ones which can be learned over time; you become the algorithm to sort out signals. Ha ha. I know that sounds like a cop out doesn't it. Did I mention it's a simple script?
One thing you might want to play with right away are fills having red and green, and lime and fuchsia. It would be cool to reduce it all down to two (2) colors, but all the boolean relations might have to be listed, and it also may not be possible to cumulatively combine transparency overlays of the same value. Visually, that approach may not result to awaken a useful feature anyway. Also, fill() has its limitations in that it cannot be in a local scope; this includes function wrapped calls to fill(), or calls made using branching logic statements if/elseif, iff(), and var = (cond) ? t_val/exp : f_val/exp. So, to my knowledge, a fill() can not be made to be logically on/off.
Please, enjoy getting some use out of it.
חפש סקריפטים עבור "THE SCRIPT"
FullPac4Trader (I.Denis)The script combines the three most important indicators on the chart.
1. A set of six moving averages ( EMA and SMA ), which can be turned on and adjusted at your discretion.
2. Indication of support and resistance levels, calculated according to the Bollinger scheme.
3. Pivot Point and the nearest goals using the Floor method with the possibility of selecting a time period.
The script version is v.1 (beta)
The development of this script will continue. Feedback and suggestions are welcome.
Beta 252 Days (NIFTY 50) by AkshayThe script derives the Beta Value of 252 days of a stock with Benchmark Index NIFTY 50. Note:- I have edited the script using an existing Beta script by Ricardo Santos. Thank you to him! :)
Optimized WaveletsThe script, High-Resolution Volume-Price Pressure Indicator with Wavelets, utilizes wavelet transforms and high-resolution data to analyze market pressure based on volume and price dynamics. The approach combines volume data from smaller timeframes (1 second) with non-linear transformation techniques to generate a refined view of market conditions. Here’s a detailed breakdown of how it works:
Key Components:
Wavelet Transform:
A wavelet function is applied to the price and volume data to capture patterns over a set time period. This technique helps identify underlying structures in the data that might be missed with traditional moving averages.
High-Resolution Data:
The indicator fetches 1-second high-resolution data for price movements and volume. This allows the strategy to capture granular price and volume changes, crucial for short-term trading decisions.
Normalized Difference:
The script calculates the normalized difference in price and volume data. By comparing changes over the selected length, it standardizes these movements to help detect sudden shifts in market pressure.
Sigmoid Transformation:
After combining the price and volume wavelet data, a sigmoid function is applied to smooth out the resulting values. This non-linear transformation helps highlight significant moves while filtering out minor fluctuations.
Volume-Price Pressure:
The up and down volume differences, together with price movements, are combined to create a "Volume-Price Pressure Score." The final indicator reflects the pressure exerted on the market by both buyers and sellers.
Indicator Plot:
The final transformed score is plotted, showing how price and volume dynamics, combined through wavelet transformation, interact. The indicator can be used to identify potential market turning points or pressure buildups based on volume and price movement patterns.
This approach is well-suited for traders looking for advanced signal detection based on high-frequency data and can provide insight into areas where typical indicators may lag or overlook short-term volatility.
Candle Pivot and Stop LossThe script plot upside and down side stop loss using pivot point and trure range.
The True Range, representing market volatility, is determined by finding the maximum value among the differences between the previous high-low, high-close, and low-close. The Downside Stop Loss is calculated by adding the True Range to the Pivot Point, while the Upside Stop Loss is calculated by subtracting the True Range from the Pivot Point.
These levels are plotted on the chart in blue (Pivot Point), red (Downside Stop Loss), and green (Upside Stop Loss), providing traders with essential reference points for their trading strategies.
The provided Pine Script calculates key trading levels for the current candle, including the Pivot Point, Downside Stop Loss, and Upside Stop Loss. The Pivot Point is computed as the average of the previous candle's high, low, and close prices.
Machine Learning using Neural Networks | EducationalThe script provided is a comprehensive illustration of how to implement and execute a simplistic Neural Network (NN) on TradingView using PineScript.
It encompasses the entire workflow from data input, weight initialization, implicit neuron calculation, feedforward computation, backpropagation for weight adjustments, generating predictions, to visualizing the Mean Squared Error (MSE) Loss Curve for monitoring the training phase.
In the visual example above, you can see that the prediction is not aligned with the actual value. This is intentional for demonstrative purposes, and by incrementing the Epochs or Learning Rate, you will see these two values converge as the accuracy increases.
Hyperparameters:
Learning Rate, Epochs, and the choice between Simple Backpropagation and a verbose version are declared as script inputs, allowing users to tailor the training process.
Initialization:
Random initialization of weight matrices (w1, w2) is performed to ensure asymmetry, promoting effective gradient updates. A seed is added for reproducibility.
Utility Functions:
Functions for matrix randomization, sigmoid activation, MSE loss calculation, data normalization, and standardization are defined to streamline the computation process.
Neural Network Computation:
The feedforward function computes the hidden and output layer values given the input.
Two variants of the backpropagation function are provided for weight adjustment, with one offering a more verbose step-by-step computation of gradients.
A wrapper train_nn function iterates through epochs, performing feedforward, loss computation, and backpropagation in each epoch while logging and collecting loss values.
Training Invocation:
The input data is prepared by normalizing it to a value between 0 and 1 using the maximum standardized value, and the training process is invoked only on the last confirmed bar to preserve computational resources.
Output Forecasting and Visualization:
Post training, the NN's output (predicted price) is computed, standardized and visualized alongside the actual price on the chart.
The MSE loss between the predicted and actual prices is visualized, providing insight into the prediction accuracy.
Optionally, the MSE Loss Curve is plotted on the chart, illustrating the loss trajectory through epochs, assisting in understanding the training performance.
Customizable Visualization:
Various inputs control visualization aspects like Chart Scaling, Chart Horizontal Offset, and Chart Vertical Offset, allowing users to adapt the visualization to their preference.
-------------------------------------------------------
The following is this Neural Network structure, consisting of one hidden layer, with two hidden neurons.
Through understanding the steps outlined in my code, one should be able to scale the NN in any way they like, such as changing the input / output data and layers to fit their strategy ideas.
Additionally, one could forgo the backpropagation function, and load their own trained weights into the w1 and w2 matrices, to have this code run purely for inference.
-------------------------------------------------------
While this demonstration does create a “prediction”, it is on historical data. The purpose here is educational, rather than providing a ready tool for non-programmer consumers.
Normally in Machine Learning projects, the training process would be split into two segments, the Training and the Validation parts. For the purpose of conveying the core concept in a concise and non-repetitive way, I have foregone the Validation part. However, it is merely the application of your trained network on new data (feedforward), and monitoring the loss curve.
Essentially, checking the accuracy on “unseen” data, while training it on “seen” data.
-------------------------------------------------------
I hope that this code will help developers create interesting machine learning applications within the Tradingview ecosystem.
Balance of Force Day of the Week (BOFDW)The script is a custom technical indicator for TradingView that is based on an analysis of the price movements of a financial instrument over the course of a week. The indicator uses a variety of inputs, including the open and close prices for each day of the week, to determine the "BOF" (BOF) for each day.
The BOF is calculated based on the relative magnitude of bullish and bearish price movements and is then used to determine the average BOF over a moving window of data points. This average BOF is displayed on the chart as an overlay, providing a measure of the average bullishness or bearishness of the financial instrument over the course of a week.
The indicator also allows users to specify the location of the overlay on the chart and to customize the appearance of the overlay with options for text and box colors. The script provides a number of built-in options for chart position, including the top-left, top-middle, top-right, middle-left, middle-center, middle-right, bottom-left, bottom-middle, and bottom-right corners of the chart.
Overall, this custom technical indicator is a useful tool for traders and investors who are looking to gain a deeper understanding of the price trends of a financial instrument over the course of a week. By providing a clear and concise measure of the average POF over time, the indicator can help users identify key patterns in the market and make more informed trading decisions.
Balance of Force (BOF)The script "Balance of Force" is an indicator that aims to provide insight into the bullish and bearish forces present in the market by analyzing the relationship between bullish and bearish true ranges. The indicator first calculates the bearish and bullish true ranges by taking the absolute difference between the open and close prices for each period and summing these values over a user-specified length. It then calculates the ratio of the bullish true range to the bearish true range and takes the natural logarithm of this value, resulting in the "bullish-bearish ratio".
The script then calculates the standard deviation of this ratio over a user-specified length to create a measure of volatility. Using this deviation and the dominant cycle, it then applies an exponential moving average to smooth the ratio. The indicator plots the smoothed ratio, the raw ratio, and the deviation of the ratio multiplied by 1, 2 and 3 in addition to filling the area between the deviation multiplied by 3 and the log(1) with red and green. The user can use the indicator to identify potential bullish or bearish market conditions by analyzing the relationship between the smoothed ratio and the log(1) and the deviation of the ratio.
Pivot Point Moving Average (PPMA)The script is an implementation of an indicator called "PPMA", which stands for "Pivot Point Moving Average." This indicator is designed to be used as a overlay, meaning that it will be plotted on top of the underlying asset's price chart.
The main function of the PPMA indicator is to calculate a moving average based on pivot points of the underlying asset. Pivot points are commonly used in technical analysis to identify key levels of support and resistance, and this indicator uses the pivot points in a unique way to calculate the moving average.
The indicator's main function, "ppma()," is defined as taking two input parameters, "left" and "right." These parameters determine the number of bars to the left and right of a pivot point that will be used to calculate the moving average. The function uses the "ta.pivothigh()" and "ta.pivotlow()" functions to identify pivot points for the high and low prices, respectively. Then the function uses the "ta.change()" function to identify if there is a change in pivot point.
The function keeps track of the number of bars and their sum from the last pivot point until the next pivot point is reached. If there is a change in pivot point, it will reset the count and sum. It will return the sum divided by the count, which is the moving average of the prices between the two pivot points.
The script then uses the PPMA function to plot the moving average on the chart using the "plot()" function. The user is able to adjust the number of bars to the left and right of the pivot point using the "left" and "right" input parameters.
In summary, the PPMA indicator is a unique moving average that uses pivot points to calculate the average. It is designed to be used as an overlay on top of an underlying asset's price chart and can be adjusted by the user to suit their needs. It can help traders identify key levels of support and resistance in the underlying asset.
TPTR_Dynamic_Ratio_CorrelatorThe script provides a way to compute ratio between two indexes (or stocks) of your choice, and paints a "up-arrow" below the first candle where and when the value of the ratio exceeds your threshold of choice.
It also creates a table summarizing the value of your securities, and the value of the ratio below.
The script will also alert you with a message (automatically) when the ratio of your security_1 and security_2 exceeds the ratio.
MA Strategy Emperor insiliconotThe Script offers 9 different EMAs with 14 different MA types.
The make use of the script is to find the entry on the 1-4 hour altcoins while using the in-built 13/21 crossover strategy to be used in sync with Heikin Ashi cross-over with Fib levels of 0.236 Fib level.
How to use it.
Entry is to be made when the
1. Cross over gives a P(Positive Sign) and the candle completely closes above the cross-over
2. When the Heikin Ashi turns green and the next green HA candle goes above the previous green HA candle.
3. The price should be at-least above the 0.236 Level from the Swing high.
All the Best.
EmperorBTC
Pi Cycle Bitcoin Top IndicatorThe script implements the Pi Cycle Top indicator
This indicator identifies tops in the bitcoin market cycle. Historically, the Pi Cycle Top indicator has called out tops in the price of bitcoin within three days.
The script is very easy to use and it is possible to change the following parameters:
the time interval (default value is day);
the days of long moving average (default value is 365)
the days of short moving average (default value is 111)
show the moving average plots
show the Pi Cycle Top label highlighting the cross-point
EMA21 Speed & AccelThe script calculates an plots first and second derivatives of a EMA of "length" periods, with a default value of 21 periods.
- Blue curve is the first derivative of the EMA, which can be interpreted as the "speed" , "slope", or percentage of gains (or loses) walking over the EMA, measured in % per period. If timeframe is Days, it will show a %/day on the scale @ the right of graphic.
- Fuchsia curve is the second derivative of the EMA, and can be assumed to be the "acceleration" or driving force that could augment or diminish the EMA Speed.
When Speed & Acceleration ar both >=0, EMA is in positive rally, and becoming stepper, so the bacground is colored green.
First and second derivatoves are performed using "basis functions", as are applied in FEM implementation.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
El Script calcula y plotea la primera y segunga derivada de una EMA de "length" períodos, con un valor por defecto de 21.
- La curva azul es la primera derivada de la EMA; que puede ser interpretada conmo su "velocidad", "pendiente" o % de ganancia o pérdida que se tendría sobre la EMA. Cuando la unidad de tiempo del gráfico es Días, permite visualizar en la escala de la derecha el % de ganancia o pérdida por día.
- La curva Fucsia muestra la segunda derivada, o "Aceleración", que se puede interpretar como la fuerza que puede aumentar o dismu¿inuir la pendiente de la EMA.
Cuando la Velocidad y Aceleración son mayores que cero, las ganancias aumentan cada período, y el findo de colorea de verde.
Las derivadas primera y segunda se calculan usando técnicas de funciones de forma, como las aplicadas en el MEF.
RSI4RULESThe Script is for use with the strategy of the 4 rules of Daven Icao. It is an RSI (black) with two Emas, 3 (blue) and 10 (red). To buy the RSI is expected to cross with the Emas in oversold zone, which is level 25; level 75 is an overbought area where we expect the RSI to cross with the Emas. If you consider that this script can be used in another strategy, use it! You can modify the values of the RSI and the Emas.
Price X volume relative trade algoThe script multiplies the price time the volumes. Than relatively calculates whether the stock or product is oversold or overbought. One can subsequently set when to go short or when to go long. The way it works is that there is a small 1 for a long and a -1 for a short. If it is 1 and the followed by a 2 one has a profit. If a -1 is followed by a -2 you traded a short with a profit.
If however a 1 is followed by a -1 you lost a long. Vice verse for the short: if the -1 is followed by a 1 you have a loss.
Once can also set a target and arrange the stop loss they way you want. A little bit complicated with many parameters to set in the setting window. But for the one who has the patient to understand the script I believe it can be very useful.
Jan de Korver:
Search the secret www.behance.net
JAR - 9 MAs with Entry Points The script allows you to display multiple MAs on the chart with customization options for the MA periods and types.
It plots buy and sell signals based on whether the MAs are in the correct order (buy) or reverse order (sell).
simple script and will have more update soon
Debug Buy/Sell Signals with Woodies CCI FilterThe script implements a trading strategy using Bollinger Bands combined with Woodies CCI (Commodity Channel Index) as a filter.
Script này triển khai một chiến lược giao dịch sử dụng Bollinger Bands kết hợp với chỉ báo CCI (Commodity Channel Index) của Woodies làm bộ lọc
Market MonitorThe script can be used to send a JSON message to the webhook once per time. For example, to store market conditions in an external database. The latter is make sense for smaller timeframes due to TradingView limitations on the number of available bars. The interval between messages can be set in the settings. To set up transmitted market metrics, you will probably need to modify the script code to add metrics that are important to you.
GREEN/RED BAR TableThe scripts analyzed past 100 candles stick to show the amounts of green and red bar.
INVEST BTC (from @tradinglord)The script highlight point of interest for investors using EMA, RSI and a bit of criticism.
The script is built to be used on a weekly timeframe
When RSI is bellow 35 it can be interesting to invest in BTC, on the opposite when it is above 80 can be where to take a bit of profits.
Also using EMA to flow with the power of the trend or change your bias depending on conditions.
Feel free to use the included alerts to be informed when RSI is telling you something.
The idea is quite simple, and you will not gain x100 your investment, but with these kind of investments and some patience you could make your way out.
Obviously not financial advice, understand what you are doing.
"Sometimes it's better to be rational monkey than a greedy baboon" - Tradinglord 2022
Autocorrelation strategy The script is purely mathematical, I plan to add a lot more to the script but for now it shows the autocorrelation 1 and 2 years into the past
(Only works with daily setting)
Retroceso 3%, 5%, 20% desde ATHThe Script shows us the% retracement that an action or ETF normally makes after it reaches its ATH, it also allows us to see the EMA 8, 21 and the MA 50 that show us the trend
El Script nos muestra el % de retroceso que normalmente hace una acción o ETF después que llega a su ATH, también nos permite ver las ver las EMA 8, 21 y la MA 50 que nos muestran la tendencia